<?php

namespace App\Admin\Actions\NewsAction;

use App\Models\User;
use Illuminate\Support\Facades\DB;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use App\Supports\LinkedIn\Client;
use Encore\Admin\Actions\BatchAction;
use Illuminate\Database\Eloquent\Collection;
use App\Jobs\TranslateNewsJob;


class BatchTranslate extends BatchAction
{
    public $name = '批量翻译';
    
    public function handle(Collection $collection)
    {
	   
	   
    	foreach ($collection as $model) {

    		 dispatch(new TranslateNewsJob($model))->onQueue('news');

    		
  	 	 }

    	
    	
	    return $this->response()->success('正在批量翻译')->refresh();
    }
	
	public function dialog()
	{
		$this->confirm('确定批量翻译吗?');
	}
}
